package club.ruanx.movie.repository;


import club.ruanx.core.repository.base.BaseRepository;
import club.ruanx.movie.entity.UserRate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Optional;

/**
 * @author 阮胜
 * @date 2018/11/11 19:50
 */
public interface UserRateRepository extends BaseRepository<UserRate, String> {

    boolean existsByUserIdAndMovieId(String userId, String movieId);

    Optional<UserRate> findByUserIdAndMovieId(String userId, String movieId);

    Page<UserRate> findAllByUserIdOrderByCreateTimeDesc(String uid, Pageable pageable);
}
